<script lang="ts">
import { defineComponent } from "vue";
import { url_api } from "@/api/customer";
import { Account } from "@/utils/account";
import { Router } from "@/utils/router";
// import { AppData } from "@/utils/app";

export default defineComponent({
  props: {
    sessionFrom: String,
  },
  setup() {
    const contactClick = () => {
      Account.checkLogin((isLogin) => {
        url_api().then((resp) => {
          Router.navigateToOrRedirectTo(isLogin, resp.mini_app_url);
        });
      });
    };

    // const contactClick = (e: MiniApp.WxEvent) => {
    //   console.log("contactClick", e);
    //   const query = objToQueryString(e.detail.query);
    //   navigateTo(`${e.detail.path}${query ? `?${query}` : ""}`);
    // };
    return { contactClick };
  },
});
</script>

<template>
  <!-- <button
    class="service-contact"
    open-type="contact"
    @contact="contactClick"
    :session-from="sessionFrom"
  /> -->
  <view class="service-contact" @click="contactClick"></view>
</template>

<style lang="scss">
.service-contact {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
}
</style>